package com.example.lxj.system.controller;


import com.example.lxj.base.annoation.Permission;
import com.example.lxj.base.controller.BaseController;
import com.example.lxj.base.entity.AjaxRes;
import com.example.lxj.system.service.ISysLoginService;
import com.example.lxj.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 菜单权限Controller
 * 
 * @author ruoyi
 * @date 2024-10-02
 */
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController
{
    @Autowired
    private ISysMenuService sysMenuService;

    @Autowired
    private ISysLoginService loginService;


    @Permission(value = "system:menu:list")
    @GetMapping("/list")
    public AjaxRes list()
    {
        return AjaxRes.success(sysMenuService.selectSysMenuList());
    }

    /**
     * 加载对应角色菜单列表树
     */
    @GetMapping(value = "/roleMenuTreeSelect/{roleId}")
    public AjaxRes roleMenuTreeSelect(@PathVariable("roleId") Long roleId)
    {
        AjaxRes ajax = AjaxRes.success();
        ajax.put("checkedKeys", sysMenuService.selectMenuListByRoleId(roleId));
        return ajax;
    }
}
